Part Number Hot Search : 
CNQ04 NTE1541 L0822 TA0426A V257F IRF14 CNQ04 4752A
Product Description
Full Text Search
 

To Download PIC16F87 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  ? 2002 microchip technology inc. ds39607b-page 1 m PIC16F87/88 1.0 device overview this document includes programming specifications for the following devices: ? PIC16F87 ? pic16f88 2.0 programming the PIC16F87/88 the PIC16F87/88 is programmed using a serial method. the serial mode will allow the PIC16F87/88 to be programmed while in the user?s system, which allows for increased design flexibility. this programming specification applies to PIC16F87/88 devices in all packages. 2.1 programming algorithm requirements the programming algorithm used depends on the operating voltage (v dd ) of the PIC16F87/88 device. both algorithms can be used with the two available programming entry methods. the first method, called low-voltage icsp tm (lvp for short), applies v dd to mclr and uses the i/o pin rb3 to enter programming mode. when rb3 is driven to v dd from ground, the PIC16F87/88 device enters programming mode. the second method follows the normal microchip programming mode entry of holding pins rb6 and rb7 low, while raising the mclr pin from v il to v ihh (13v 0.5v). 2.2 programming mode the programming mode for the PIC16F87/88 allows programming of user program memory, data memory, special locations used for id, and the configuration words. figure 2-1: PIC16F87 18-pin dip, soic algorithm # v dd range 12.0v v dd <5.5v 24.5v v dd 5.5v ra1/an1 ra0/an0 ra7/osc1/clki ra6/osc2/clko v dd rb7/pgd/t1osi rb6/pgc/t1oso/t1cki rb5/ss /tx/ck rb4/sck/scl ra2/an2/cv ref ra3/an3/c1out ra4/t0cki/c2out ra5/mclr /v pp v ss rb0/int/ccp1 (1) rb1/sdi/sda rb2/sdo/rx/dt rb3/pgm/ccp1 (1) 1 2 3 4 5 6 7 8 9 18 17 16 15 14 13 12 11 10 PIC16F87 note 1: location of ccp1 function is determined by ccpmx. flash memory programming specification
PIC16F87/88 ds39607b-page 2 ? 2002 microchip technology inc. figure 2-2: PIC16F87 20-pin ssop figure 2-3: PIC16F87 28-pin qfn rb7/pgd/t1osi rb6/pgc/t1oso/t1cki ra7/osc1/clki ra6/osc2/clko v dd rb5/ss /tx/ck rb4/sck/scl rb3/pgm/ccp1 (1) rb2/sdo/rx/dt ra0/an0 ra1/an1 ra4/t0cki/c2out ra5/mclr /v pp v ss ra2/an2/cv ref ra3/an3/c1out rb0/int/ccp1 (1) rb1/sdi/sda 1 2 3 4 5 6 7 8 9 20 19 18 17 16 15 14 13 12 av dd av ss 10 11 PIC16F87 note 1: location of ccp1 function is determined by ccpmx. 16 2 ra2/an2/cv ref ra0/an0 ra4/t0cki/c2out ra5/mclr /v pp nc av ss nc rb0/int/ccp1 (1) rb1/sdi/sda ra3/an3/c1out ra7/osc1/clki ra6/osc2/clko v dd nc av dd rb7/pgd/t1osi rb6/pgc/t1oso/t1cki rb5/ss /tx/ck rb4/sck/scl 7 PIC16F87 1 3 6 5 4 15 21 19 20 17 18 22 28 26 27 23 24 25 14 8 10 9 13 12 11 v ss nc nc ra1/an1 rb2/sdo/rx/dt rb3/pgm/ccp1 (1) nc nc nc note 1: location of ccp1 function is determined by ccpmx.
? 2002 microchip technology inc. ds39607b-page 3 PIC16F87/88 figure 2-4: pic16f88 18-pin dip, soic figure 2-5: pic16f88 20-pin ssop ra1/an1 ra0/an0 ra7/osc1/clki ra6/osc2/clko v dd rb7/an6/pgd/t1osi rb6/an5/pgc/t1oso/t1cki rb5/ss /tx/ck rb4/sck/scl ra2/an2/cv ref /v ref - ra3/an3/v ref +/c1out ra4/an4/t0cki/c2out ra5/mclr /v pp v ss rb0/int/ccp1 (1) rb1/sdi/sda rb2/sdo/rx/dt rb3/pgm/ccp1 (1) 1 2 3 4 5 6 7 8 9 18 17 16 15 14 13 12 11 10 pic16f88 note 1: location of ccp1 function is determined by ccpmx. rb7/an6/pgd/t1osi rb6/an5/pgc/t1oso/t1cki ra7/osc1/clki ra6/osc2/clko v dd rb5/ss /tx/ck rb4/sck/scl rb3/pgm/ccp1 (1) rb2/sdo/rx/dt ra0/an0 ra1/an1 ra4/an4/t0cki/c2out ra5/mclr /v pp v ss ra2/an2/cv ref /v ref - ra3/an3/v ref +/c1out rb0/int/ccp1 (1) rb1/sdi/sda 1 2 3 4 5 6 7 8 9 20 19 18 17 16 15 14 13 12 av dd av ss 10 11 pic16f88 note 1: location of ccp1 function is determined by ccpmx.
PIC16F87/88 ds39607b-page 4 ? 2002 microchip technology inc. figure 2-6: pic16f88 28-pin qfn table 2-1: pin descriptions (during programming): PIC16F87/88 16 2 ra2/an2/cv ref /v ref - ra0/an0 ra4/an4/t0cki/c2out ra5/mclr /v pp nc av ss nc rb0/int/ccp1 (1) rb1/sdi/sda ra3/an3/v ref +/c1out ra7/osc1/clki ra6/osc2/clko v dd nc av dd rb7/an6/pgd/t1osi rb6/an5/pgc/t1oso/t1cki rb5/ss /tx/ck rb4/sck/scl 7 pic16f88 1 3 6 5 4 15 21 19 20 17 18 22 28 26 27 23 24 25 14 8 10 9 13 12 11 v ss nc nc ra1/an1 rb2/sdo/rx/dt rb3/pgm/ccp1 (1) nc nc nc note 1: location of ccp1 function is determined by ccpmx. pin name during programming function pin type pin description rb3 pgm i low-voltage icsp programming input if lvp configuration bit equals ? 1 ? rb6 clock i clock input rb7 data i/o data input/output mclr v pp p * program mode select v dd v dd p power supply v ss v ss p ground legend: i = input, o = output, p = power * to activate the programming mode, high voltage needs to be applied to the mclr input. since mclr is used for a level source, this means that mclr does not draw any significant current.
? 2002 microchip technology inc. ds39607b-page 5 PIC16F87/88 3.0 program mode entry 3.1 user program memory map the user memory space extends from 0x0000 to 0x1fff (8k), of which 4k (0000h-0fffh) is physically implemented. in programming mode, the program memory space extends from 0x0000 to 0x3fff, with the first half (0x0000-0x1fff) being user program memory and the second half (0x2000-0x3fff) being configuration memory. the pc will increment from 0x0000 to 0x0fff, then increment to 0x1000 and access 0x0000. once the pc reaches 0x1fff, it will increment to 0x2000. from 0x2000, the pc will increment up to 0x3fff and wrap around to 0x2000 (not to 0x0000). once in configuration memory, the highest bit of the pc stays a ? 1 ?, always pointing to the configuration memory. the only way to point to user program memory is to reset the part and re-enter program mode, as described in section 3.4 ?program mode? . in the configuration memory space, 0x2000-0x201f are physically implemented. however, only locations 0x2000 through 0x2008 are available. other locations are reserved. locations beyond 0x201f will physically access user memory (see figure 3-1). 3.2 data eeprom memory the eeprom data memory space is a separate block of high-endurance memory that the user accesses using a special sequence of instructions. the amount of data eeprom memory depends on the device and is shown below in number-of-bytes. the contents of data eeprom memory have the capability to be embedded into the hex file. the programmer should be able to read data eeprom information from a hex file and conversely (as an option) write data eeprom contents to a hex file, along with program memory information and configuration bit information. the 256 data memory locations are logically mapped and use pc<7:0>. the format for data memory storage is one data byte per address location, lsb aligned. device program flash PIC16F87 4k pic16f88 4k device # of bytes PIC16F87 256 pic16f88 256
PIC16F87/88 ds39607b-page 6 ? 2002 microchip technology inc. 3.3 id locations a user may store identification information (id) in four id locations. the id locations are mapped in [0x2000:0x2003]. it is recommended that the user use only the four least significant bits of each id location. in some devices, the id locations read out in an unscrambled fashion once code-protection is enabled. for these devices, it is recommended that id location be written as ? 11 1111 1000 bbbb ?, where ? bbbb ? is id information. in other devices, the id locations read out normally, even after code protection. to understand how the devices behave, refer to table 6-1. figure 3-1: program memory mapping 4k words implemented accesses 0x0000 to 0x0fff reserved id location id location id location id location reserved reserved device id configuration word 1 configuration word 2 2000h 2001h 2002h 2003h 2004h 2005h 2006h 2007h 0h fffh 1fffh 2009h 3fffh 2008h
? 2002 microchip technology inc. ds39607b-page 7 PIC16F87/88 3.4 program mode program mode is entered by holding pins rb6 and rb7 low, while raising mclr pin from v il to v ihh (high voltage). in this mode, the state of the rb3 pin does not effect programming. low-voltage icsp programming mode is entered by raising rb3 from v il to v dd , and then applying v dd to mclr . once in this mode, the user program memory, as well as the configuration memory, can be accessed and programmed in serial fashion. the mode of operation is serial, and the memory accessed is the user program memory. rb6 and rb7 are schmitt trigger inputs in this mode. the sequence that enters the device into the programming mode places all other logic into the reset state (the mclr pin was initially at v il ). this means all i/o are in the reset state (high-impedance inputs). a device reset will clear the pc and set the address to ? 0 ?. the ?increment address? command will increment the pc. the ?load configuration? command will set the pc to 0x2000. the available commands are shown in table 3-1. the normal sequence for programming four program memory words at a time is as follows: 1. set pointer to row location. 2. issue a ?begin erase? command. 3. wait tprog2. 4. issue an ?end programming? command. 5. load a word at the current program memory address using the ?load data? command. 6. issue an ?increment address? command. 7. load a word at the current program memory address using the ?load data? command. 8. repeat step 6 and step 7 two times. 9. issue a ?begin programming? command to begin programming. 10. wait tprog1. 11. issue an ?end programming? command. 12. increment to the next address. 13. repeat steps 5 through 12 seven times to program one row. the address and program counter are reset to 0x0000 by resetting the device (taking mclr below v il ) and re-entering programming mode. program and configuration memory may then be read or verified using the ?read data? and ?increment address? commands. 3.4.1 low-voltage icsp programming mode low-voltage icsp programming mode allows a PIC16F87/88 device to be programmed using v dd only. however, when this mode is enabled by a configuration bit (lvp), the PIC16F87/88 device dedicates rb3 to control entry/exit into programming mode. when the lvp bit is set to ? 1 ?, the low-voltage icsp programming entry is enabled. since the lvp configuration bit allows low-voltage icsp programming entry in its erased state, an erased device will have the lvp bit enabled at the factory. while lvp is ? 1 ?, rb3 is dedicated to low-voltage icsp programming. the following lvp steps assume the lvp bit is set in the configuration register. 1. apply v dd to the v dd pin. 2. drive mclr low. 3. apply v dd to the rb3/pgm pin. 4. apply v dd to the mclr pin. all other specifications for high-voltage icsp apply. to disable low-voltage icsp mode, the lvp bit must be programmed to ? 0 ?. this must be done while entered with the high-voltage entry mode (lvp bit = 1 ). rb3 is now a general purpose i/o pin. note: the osc must not have 72 osc clocks while the device mclr is between v il and v ihh . note: the mclr pin should be raised from below v il to above the minimum v ihh (v pp ), within 250 s of v dd rise. this ensures that the device always enters programming mode before any instructions that may be in program memory can be executed. otherwise, unintended instruction execution could occur when the intrc clock source is configured as the primary clock. refer to figure 7-1.
PIC16F87/88 ds39607b-page 8 ? 2002 microchip technology inc. 3.4.2 serial program operation the rb6 pin is used as a clock input pin, while the rb7 pin is used to enter command bits, and input or output data during serial operation. to input a command, the clock pin (rb6) is cycled six times. each command bit is latched on the falling edge of the clock, with the least significant bit (lsb) of the command being input first. the data on rb7 is required to have a minimum setup (tset1) and hold (thold1) time (see ac/dc specifications), with respect to the falling edge of the clock. commands with associated data (read and load) are specified to have a minimum delay (tdly1) of 1 s between the command and the data. after this delay, the clock pin is cycled 16 times, with the first cycle being a start bit (0) and the last cycle being a stop bit (0). data is transferred lsb first. during a read operation, the lsb will be transmitted onto rb7 on the rising edge of the second cycle, while, during a load operation, the lsb will be latched on the falling edge of the second cycle. a minimum 1 s delay (tdly2) is specified between consecutive commands. all commands and data words are transmitted lsb first. the data is transmitted on the rising edge and latched on the falling edge of the clock. to allow decoding of commands and reversal of data pin configuration, a time separation of at least 1 s (tdly1) is required between a command and a data word, or another command. the available commands are described in the following paragraphs and listed in table 3-1. 3.4.2.1 load configuration upon receipt of the load configuration command, the pc will be set to 0x2000 and the data sent with the command is discarded. the four id locations and the configuration words can then be programmed using the normal programming sequence, as described in section 3.4 ?program mode? . a description of the memory mapping schemes of the program memory for normal operation and configuration mode operation is shown in figure 3-1. once the configuration memory is entered, the only way to get back to the user program memory is to exit the program/verify test mode by taking mclr low (v il ). 3.4.2.2 load data for program memory after receiving this command, the chip will load one word (with 14 bits as a ?data word?) to be programmed into user program memory when 16 cycles are applied. a timing diagram for this command is shown in figure 7-1. 3.4.2.3 load data for data memory after receiving this command, the chip will load a 14-bit ?data word? when 16 cycles are applied. however, the data memory is only 8 bits wide and, thus, only the first 8 bits of data after the start bit will be programmed into the data memory (8 data bits and 6 zeros). it is still necessary to cycle the clock the full 16 cycles in order to allow the internal circuitry to reset properly. the data memory contains up to 256 bytes. if the device is code protected, the data is read as all zeros. a timing diagram for this command is shown in figure 7-2. 3.4.2.4 read data from program memory after receiving this command, the chip will transmit data bits out of the program memory (user or configuration) currently accessed, starting with the second rising edge of the clock input. the rb7 pin will go into output mode on the second rising clock edge, reverting to input mode (high-impedance) after the 16th rising edge. a timing diagram of this command is shown in figure 7-3. 3.4.2.5 read data from data memory after receiving this command, the chip will transmit data bits out of the data memory, starting with the second rising edge of the clock input. the rb7 pin will go into output mode on the second rising edge, reverting to input mode (high-impedance) after the 16th rising edge. as previously stated, the data memory is 8-bits wide and, therefore, only the first 8 bits that are output are actual data. a timing diagram for this command is shown in figure 7-4. 3.4.2.6 increment address the pc is incremented when this command is received. a timing diagram of this command is shown in figure 7-5. note: upon entering programming mode, a ?load data for program memory? or ?load data for data memory? command of 0x01 must be given before a begin erase or begin programming command is initiated. this will ensure that the programming pointer is pointing to the correct location in data or program memory.
? 2002 microchip technology inc. ds39607b-page 9 PIC16F87/88 3.4.2.7 begin erase (program and data memory) the erase block size for program memory is 32 words (row) and 1 word for data memory. the row or word to be programmed must first be erased. this is done by setting the pointer to a location in the row or word and then performing a ?begin erase? command. the row or word is then erased. the user must allow the combined time for row erase and programming, as specified in the electrical specifications, for programming to complete. this is an externally timed event. the internal timer is not used for this command, so the ?end programming? command must be used to stop erase. a timing diagram for this command is shown in figure 7-6. 3.4.2.8 begin programming only programming of program and data memory will begin once this command is received and decoded. the user must allow the time for programming, as specified in the electrical specifications, for programming to complete. an ?end programming? command is required. the internal timer is not used for this command, so the ?end programming? command must be used to stop programming. 1. if the address is pointing to user memory, the user memory alone will be affected. 2. if the address is pointing to the physically implemented configuration memory (2000h- 2008h), the configuration memory will be written. the configuration words will not be written unless the address is specifically pointing to the corresponding address. a timing diagram for this command is shown in figure 7-7. 3.4.2.9 end programming after receiving this command, the chip stops programming the memory (configuration memory or user program memory) that it was programming at the time. table 3-1: command mapping for PIC16F87/88 note 1: the code-protect bits cannot be erased with this command. 2: all ?begin erase? operations can take place over the entire v dd range. note: this command will also set the write data shift latches to all ? 1 ?s to avoid issues with downloading only one word before the write. command mapping (msb ? lsb) data voltage range load configuration 00000 0, data (14), 0 2.0v-5.5v load data for program memory 00010 0, data (14), 0 2.0v-5.5v read data from program memory 00100 0, data (14), 0 2.0v-5.5v increment address 00110 2.0v-5.5v begin erase 01000 externally timed 2.0v-5.5v begin programming only cycle 11000 externally timed 2.0v-5.5v bulk erase program memory 01001 externally timed 4.5v-5.5v bulk erase data memory 01011 externally timed 4.5v-5.5v chip erase 11111 internally timed 4.5v-5.5v load data for data memory 00011 0, zeroes (6), data (8), 0 2.0v-5.5v read data from data memory 00101 0, zeroes (6), data (8), 0 2.0v-5.5v end programming 10111
PIC16F87/88 ds39607b-page 10 ? 2002 microchip technology inc. 3.5 erasing program and data memory depending on the state of the code protection bits, program and data memory will be erased using different methods. the first two commands are used when both program and data memories are not code protected. the third command is used when either memory is code protected, or if you want to also erase the code protect bits. a device programmer should determine the state of the code protection bits and then apply the proper command to erase the desired memory. 3.5.1 erasing program and data memory when both program and data memories are not code- protected, they can be individually erased by the following ?bulk erase? commands. if it is desired to erase both program and data memory with a single command, the ?chip erase? command must be used whether code protection is disabled or enabled (detailed in section 3.5.1.3 ?chip erase? ). 3.5.1.1 bulk erase program memory when this command is performed, and is followed by a ?begin erase? command, the entire program memory will be erased. if the address is pointing to user memory, only the user memory will be erased. if the address is pointing to the configuration memory (2000h-2008h), then both the user memory and the configuration memory will be erased. the configuration words will not be erased, even if the address is pointing to location 2007h. previously, a load data with 0ffh command was recommended before any ?bulk erase?. on these devices, this will not be required. the ?bulk erase? command is disabled when the cp bit is programmed to ? 0 ?, enabling code-protect. a timing diagram for this command is shown in figure 7-8. 3.5.1.2 bulk erase data memory when this command is performed, and is followed by a ?begin erase? command, the entire data memory will be erased. the ?bulk erase data? command is disabled when the cpd bit is programmed to ? 0 ?, enabling protected data memory. a timing diagram for this command is shown in figure 7-9. 3.5.1.3 chip erase this command, when performed, will erase the program memory, ee data memory, and all of the code protection bits. all on-chip flash and eeprom memory is erased, regardless of the address contained in the pc. when a chip erase command is issued and the pc points to (0000h-1fffh), the configuration words (2007h and 2008h) and the user program memory will be erased. when a chip erase command is issued and the pc points to (2000h-2008h), all of the configuration memory, program memory, and data memory will be erased. the chip erase is internally self-timed to ensure that all program and data memory are erased before the code protect bits are erased. a timing diagram for this command is shown in figure 7-10. 3.5.2 erasing code-protected memory for the PIC16F87/88 devices, once code protection is enabled, all protected program and data memory locations read all '0's and further programming is disabled. the id locations and configuration words read out unscrambled and can be reprogrammed normally. the only command to erase a code-protected PIC16F87/88 device is the ?chip erase?. this erases program memory, data memory, configuration bits and id locations, as described in section 3.5.1.3 ?chip erase? . since all data within the program and data memory will be erased when this command is executed, the security of the data or code is not compromised. note: all ?bulk erase? operations must take place at the 4.5v to 5.5v v dd range. note: the chip erase operation must take place at the 4.5v to 5.5v v dd range.
? 2002 microchip technology inc. ds39607b-page 11 PIC16F87/88 figure 3-2: algorithm 1 flow chart ? program memory (2.0v v dd < 5.5v) start set v dd = v ddp row locations done? end increment address command no no load data four loads done? begin programming only increment address command no command yes command wait tprog1 data correct? report verify error no yes verify all locations increment address command end programming command begin erase command all yes ye s end programming command wait tprog2 all locations done?
PIC16F87/88 ds39607b-page 12 ? 2002 microchip technology inc. figure 3-3: algorithm 2 flow chart ? program memory (4.5v v dd 5.5v) start set v dd = v ddp wait tprog1 all locations done? end no begin programming only command chip erase sequence verify all data correct? locations increment address command no report verify error programming end command load data four loads done? increment address command no command yes ye s yes
? 2002 microchip technology inc. ds39607b-page 13 PIC16F87/88 figure 3-4: flow chart ? PIC16F87/88 configuration memory (2.0v v dd < 5.5v) and (4.5v v dd < 5.5v) load data command begin program only command wait tprog1 program four locations load data command begin program only command wait tprog1 program config1 end start start four loads done? increment address command no yes end begin erase command wait tprog2 end programming command end programming command and end programming command program id start load configuration data location? program four read data command data correct? report programming failure increment address command increment address command increment address command increment address command program config1 read data command data correct? report program configuration word error end yes no yes no no ye s yes no address = 0x2004? locations (set pc = 2000h) address = 0x2003? increment address command no yes load configuration data increment address program config2 command config2
PIC16F87/88 ds39607b-page 14 ? 2002 microchip technology inc. 4.0 configuration word the PIC16F87/88 has several configuration bits. these bits can be written to ? 0 ? or ? 1 ? with the ?begin program only? command. a ?begin erase? command is not required when programming configuration memory. 4.1 device id word the device id word for the PIC16F87/88 is located at 2006h. table 4-1: device id value device device id value dev rev PIC16F87 00 0111 0010 xxxx pic16f88 00 0111 0110 xxxx
? 2002 microchip technology inc. ds39607b-page 15 PIC16F87/88 register 4-1: configuration word 1 (2007h) register cp ccpmx debug wrt1 wrt0 cpd lvp boren mclre fosc2 pwrten wdten fosc1 fosc0 bit 13 bit 0 bit 13 cp: flash program memory code protection bits 1 = code protection off 0 = 0000h to 0fffh code protected (all protected) bit 12 ccpmx: ccp mux bit 1 = ccp1 function on rb0 0 = ccp1 function on rb3 bit 11 debug: in-circuit debugger mode bit 1 = in-circuit debugger disabled, rb6 and rb7 are general purpose i/o pins 0 = in-circuit debugger enabled, rb6 and rb7 are dedicated to the debugger bit 10-9 wrt1:wrt0: flash program memory write enable bits 11 = write protection off 10 = 0000h to 00ffh write-protected, 0100h to 0fffh may be modified by eecon control 01 = 0000h to 07ffh write-protected, 0800h to 0fffh may be modified by eecon control 00 = 0000h to 0fffh write-protected bit 8 cpd: data ee memory code protection bit 1 = code protection off 0 = data ee memory code-protected bit 7 lvp: low-voltage programming enable bit 1 = rb3/pgm pin has pgm function, low-voltage programming enabled 0 = rb3 is digital i/o, hv on mclr must be used for programming bit 6 boren: brown-out reset enable bit 1 = bor enabled 0 = bor disabled bit 5 mclre: ra5/mclr pin function select bit 1 = ra5/mclr pin function is mclr 0 = ra5/mclr pin function is digital i/o, mclr internally tied to v dd bit 3 pwrten : power-up timer enable bit 1 = pwrt disabled 0 = pwrt enabled bit 2 wdten: watchdog timer enable bit 1 = wdt enabled 0 = wdt disabled bit 4, 1-0 fosc2:fosc0: oscillator selection bits 111 = extrc oscillator; clko function on ra6/osc2/clko 110 = extrc oscillator; port i/o function on ra6/osc2/clko 101 = intrc oscillator; clko function on ra6/osc2/clko 100 = intrc oscillator; port i/o function on ra6/osc2/clko 011 = extclk; port i/o function on ra6/osc2/clko 010 = hs oscillator 001 = xt oscillator 000 = lp oscillator legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown
PIC16F87/88 ds39607b-page 16 ? 2002 microchip technology inc. register 4-2: configuration word 2 (2008h) register u-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 ? ? ? ? ? ? ? ? ? ? ? ?iesofcmen bit 13 bit 0 bit 13-2 unimplemented: read as ? 1 ? bit 1 ieso: internal external switch over bit 1 = internal external switch over mode enabled 0 = internal external switch over mode disabled bit 0 fcmen: fail-safe clock monitor enable bit 1 = fail-safe clock monitor enabled 0 = fail-safe clock monitor disabled legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown
? 2002 microchip technology inc. ds39607b-page 17 PIC16F87/88 5.0 embedding configuration word and id information in hex file 6.0 checksum computation checksum is calculated by reading the contents of the PIC16F87/88 memory locations and totaling the opcodes, up to the maximum user-addressable location (e.g., 0xfff for the PIC16F87/88). any carry bits exceeding 16 bits are neglected. finally, the configuration word (appropriately masked) is added to the checksum. checksum computation for each member of the PIC16F87/88 devices is shown in table 6-1. the checksum is calculated by summing the following: ? the contents of all program memory locations ? the configuration words, appropriately masked ? masked id locations (when applicable) the least significant 16 bits of this sum are the checksum. the following table describes how to calculate the checksum for each device. note that the checksum calculation differs depending on the code protect setting. since the program memory locations read out differently depending on the code protect setting, the table describes how to manipulate the actual program memory values to simulate the values that would be read from a protected device. when calculating a checksum by reading a device, the entire program memory can simply be read and summed. the configuration words and id locations can always be read. note that some older devices have an additional value added in the checksum. this is to maintain compatibility with older device programmer checksums. to allow portability of code, the programmer is r equired to read the configuration word and id locations from the hex file when loading the hex file. if configuration word information was not present in the hex file, a simple warning message may be issued. similarly, while saving a hex file, configuration word and id information must be included. an option to not include this information may be provided. specifically for the PIC16F87/88, the eeprom data memory should also be embedded in the hex file (see section 3.2 ?data eeprom memory? ). microchip technology inc. feels strongly that this feature is important for the benefit of the end customer. table 6-1: checksum computation device code- protect checksum* blank value 0x25e6 at 0 and max address PIC16F87 off sum(0000:0fff) + (config0 & 3fff) + (config1 & 0003) 3002 fbd0 on (config0 & 3fff) + (config1 & 0003) + sum_id 5004 ibd2 pic16f88 off sum(0000:0fff) + (config0 & 3fff) + (config1 & 0003) 3002 fbd0 on (config0 & 3fff) + (config1 & 0003) + sum_id 5004 ibd2 legend: cfgw = configuration word sum[a:b] = [sum of locations a to b inclusive] sum_id = id locations masked by 0xf, then made into a 16-bit value with id0 as the most significant nibble. for example, id0 = 0x1, id1 = 0x2, id3 = 0x3, id4 = 0x4, then sum_id = 0x1234. *checksum = [sum of all the individual expressions] modulo [0xffff] + = addition & = bitwise and
PIC16F87/88 ds39607b-page 18 ? 2002 microchip technology inc. 7.0 program mode electrical characteristics table 7-1: timing requirements for program mode ac/dc characteristics power supply pins standard operating procedure (unless otherwise stated) operating temperature 0 t a +70c operating voltage 2.0v v dd 5.5v characteristics sym min typ max units conditions/comments general v dd level for begin erase, begin program operations and eecon1 writes of program memory v dd 2.0 ? 5.5 v v dd level for begin erase, begin program operations and eecon1 writes of data memory v dd 2.0 ? 5.5 v v dd level for bulk erase, chip erase, and begin program operations of program and data memory v dd 4.5 ? 5.5 v begin programming only cycle time tprog1 1 ? ? ms externally timed, > 4.5v 2 ? ? ms externally timed, < 4.5v begin erase tprog2 1 ? ? ms externally timed, > 4.5v 2 ? ? ms externally timed, < 4.5v bulk erase cycle time tprog3 2 ? ? ms externally timed chip erase cycle time tprog4 8 ? ? ms internally timed high voltage on mclr and ra4/t0cki for program mode entry v ihh v dd + 3.5 ? 13.5 v mclr rise time (v ss to v hh ) for program mode entry tvhhr ? ? 1.0 s (rb6, rb7) input high level v ih 10.8v dd ? ? v schmitt trigger input (rb6, rb7) input low level v il 10.2v dd ? ? v schmitt trigger input rb<7:4> setup time before mclr (program mode selection pattern setup time) tset0 100 ? ? ns rb<7:4> hold time after mclr (program mode selection pattern setup time) thld0 5 ? ? s serial program data in setup time before clock tset1 100 ? ? ns data in hold time after clock thld1 100 ? ? ns data input not driven to next clock input (delay required between command/data or command/ command) tdly1 1.0 ? ? s2.0v v dd < 4.5v 100 ? ? ns 4.5v v dd 5.5v delay between clock to clock of next command or data tdly2 1.0 ? ? s2.0v v dd < 4.5v 100 ? ? ns 4.5v v dd 5.5v clock to data out valid (during read data) tdly3 80 ? ? ns setup time between v dd rise and mclr rise tpu tset0 ? 250 s
? 2002 microchip technology inc. ds39607b-page 19 PIC16F87/88 figure 7-1: load data for user program memory command (program) figure 7-2: load data for user data memory command (program) figure 7-3: read data from program memory command (program)     mclr v ihh tset0 rb6 (clock) rb7 (data) reset tset1 thld1 tdly1 1 s min program mode tset1 thld1 100 ns min 1 s min tdly2 12 3 4 5 6 0 1 000 x 12 3 4 5 15 16 strt_bit stp_bit 100 ns min } thld0 } } }     mclr v ihh tset0 rb6 (clock) rb7 (data) reset tset1 thld1 tdly1 1 s min program mode tset1 thld1 100 ns min 1 s min tdly2 12 3 4 56 1 1 000 x 12 3 4 5 15 16 strt_bit stp_bit 100 ns min } thld0 } } }     mclr v ihh tset0 rb6 (clock) rb7 (data) reset tdly1 1 s min program mode tset1 thld1 1 s min tdly2 12 3 4 56 00100 x 12 3 4 5 15 16 100 ns min } } tdly3 rb7 = input rb7 = output rb7 input thld0 bit 0 bit 13
PIC16F87/88 ds39607b-page 20 ? 2002 microchip technology inc. figure 7-4: read data from data memory command (program) figure 7-5: increment address command (serial program) figure 7-6: begin erase (serial program)     mclr v ihh tset0 rb6 (clock) rb7 (data) reset tdly1 1 s min program mode tset1 thld1 1 s min tdly2 12 3 4 56 1 01 0 0 x 12 34 515 16 100 ns min } } tdly3 rb7 = input rb7 = output rb7 input thld0 bit 0 bit 13 mclr v ihh rb6 (clock) rb7 (data) reset tdly1 1 s min. program mode tset1 thld1 1 s min. tdly2 12 3 4 56 011 xx 12 100 ns min. } } x0 0 next command mclr v ihh rb6 (clock) rb7 (data) reset ? program mode tset1 thld1 tprog2 12 3 4 56 010x 12 100 ns min. } } x0 end programming command 00
? 2002 microchip technology inc. ds39607b-page 21 PIC16F87/88 figure 7-7: begin programing only command (serial program) figure 7-8: bulk erase program memory command (serial program/verify) figure 7-9: bulk erase data memory command (serial program/verify) mclr v ihh rb6 (clock) rb7 (data) reset ? program mode tset1 thld1 tprog1 12 3 4 56 12 100 ns min. } } x0 end programming command 0 11x 00 mclr v ihh rb6 (clock) rb7 (data) reset program/verify test mode tset1 thld1 12 3 4 56 100 xx 12 100 ns min. } } x0 1 ? tprog3 begin erase 12 x0 end programming mclr v ihh rb6 (clock) rb7 (data) reset program/verify test mode tset1 thld1 12 3 4 56 1 1 0 xx 100 ns min. } } 1 12 x0 begin erase 12 x0 end programming ? tprog3
PIC16F87/88 ds39607b-page 22 ? 2002 microchip technology inc. figure 7-10: chip erase command (serial program) figure 7-11: program mode entry mclr v ihh rb6 (clock) rb7 (data) reset program mode tset1 thld1 tprog4 1234 56 111 x x 12 100 ns min. } } x0 1 next command tdly1 1 s min. mclr v ihh rb6 (clock) rb7 (data) reset program mode 1234 5 v dd tpu
ds39607b-page 23 ? 2003 microchip technology inc. information contained in this publication regarding device applications and the like is intended through suggestion only and may be superseded by updates. it is your responsibility to ensure that your application meets with your specifications. no representation or warranty is given and no liability is assumed by microchip technology incorporated with respect to the accuracy or use of such information, or infringement of patents or other intellectual property rights arising from such use or otherwise. use of microchip?s products as critical com- ponents in life support systems is not authorized except with express written approval by microchip. no licenses are con- veyed, implicitly or otherwise, under any intellectual property rights. trademarks the microchip name and logo, the microchip logo, accuron, dspic, k ee l oq , mplab, pic, picmicro, picstart, pro mate and powersmart are registered trademarks of microchip technology incorporated in the u.s.a. and other countries. amplab, filterlab, micro id , mxdev, mxlab, picmaster, seeval, smartshunt and the embedded control solutions company are registered trademarks of microchip technology incorporated in the u.s.a. application maestro, dspicdem, dspicdem.net, dspicworks, ecan, economonitor, fansense, flexrom, fuzzylab, in-circuit serial programming, icsp, icepic, microport, migratable memory, mpasm, mplib, mplink, mpsim, pickit, picdem, picdem.net, pictail, powercal, powerinfo, powermate, powertool, rflab, rfpic, select mode, smartsensor, smarttel and total endurance are trademarks of microchip technology incorporated in the u.s.a. and other countries. serialized quick turn programming (sqtp) is a service mark of microchip technology incorporated in the u.s.a. all other trademarks mentioned herein are property of their respective companies. ? 2003, microchip technology incorporated, printed in the u.s.a., all rights reserved. printed on recycled paper. note the following details of the code protection feature on microchip devices: ? microchip products meet the specification contained in their particular microchip data sheet. ? microchip believes that its family of products is one of the most secure families of its kind on the market today, when used i n the intended manner and under normal conditions. ? there are dishonest and possibly illegal methods used to breach the code protection feature. all of these methods, to our knowledge, require using the microchip products in a manner outside the operating specifications contained in microchip's data sheets. most likely, the person doing so is engaged in theft of intellectual property. ? microchip is willing to work with the customer who is concerned about the integrity of their code. ? neither microchip nor any other semiconductor manufacturer can guarantee the security of their code. code protection does not mean that we are guaranteeing the product as ?unbreakable.? code protection is constantly evolving. we at microchip are committed to continuously improving the code protection features of our products. attempts to break microchip?s code protection feature may be a violation of the digital millennium copyright act. if such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that act. microchip received iso/ts-16949:2002 quality system certification for its worldwide headquarters, design and wafer fabrication facilities in chandler and tempe, arizona and mountain view, california in october 2003 . the company?s quality system processes and procedures are for its picmicro ? 8-bit mcus, k ee l oq ? code hopping devices, serial eeproms, microperipherals, non-volatile memory and analog products. in addition, microchip?s quality system for the design and manufacture of development systems is iso 9001:2000 certified.
ds39607b-page 24 ? 2002 microchip technology inc. m americas corporate office 2355 west chandler blvd. chandler, az 85224-6199 tel: 480-792-7200 fax: 480-792-7277 technical support: 480-792-7627 web address: http://www.microchip.com atlanta 3780 mansell road, suite 130 alpharetta, ga 30022 tel: 770-640-0034 fax: 770-640-0307 boston 2 lan drive, suite 120 westford, ma 01886 tel: 978-692-3848 fax: 978-692-3821 chicago 333 pierce road, suite 180 itasca, il 60143 tel: 630-285-0071 fax: 630-285-0075 dallas 4570 westgrove drive, suite 160 addison, tx 75001 tel: 972-818-7423 fax: 972-818-2924 detroit tri-atria office building 32255 northwestern highway, suite 190 farmington hills, mi 48334 tel: 248-538-2250 fax: 248-538-2260 kokomo 2767 s. albright road kokomo, in 46902 tel: 765-864-8360 fax: 765-864-8387 los angeles 18201 von karman, suite 1090 irvine, ca 92612 tel: 949-263-1888 fax: 949-263-1338 phoenix 2355 west chandler blvd. chandler, az 85224-6199 tel: 480-792-7966 fax: 480-792-4338 san jose 1300 terra bella avenue mountain view, ca 94043 tel: 650-215-1444 toronto 6285 northam drive, suite 108 mississauga, ontario l4v 1x5, canada tel: 905-673-0699 fax: 905-673-6509 asia/pacific australia suite 22, 41 rawson street epping 2121, nsw australia tel: 61-2-9868-6733 fax: 61-2-9868-6755 china - beijing unit 706b wan tai bei hai bldg. no. 6 chaoyangmen bei str. beijing, 100027, china tel: 86-10-85282100 fax: 86-10-85282104 china - chengdu rm. 2401-2402, 24th floor, ming xing financial tower no. 88 tidu street chengdu 610016, china tel: 86-28-86766200 fax: 86-28-86766599 china - fuzhou unit 28f, world trade plaza no. 71 wusi road fuzhou 350001, china tel: 86-591-7503506 fax: 86-591-7503521 china - hong kong sar unit 901-6, tower 2, metroplaza 223 hing fong road kwai fong, n.t., hong kong tel: 852-2401-1200 fax: 852-2401-3431 china - shanghai room 701, bldg. b far east international plaza no. 317 xian xia road shanghai, 200051 tel: 86-21-6275-5700 fax: 86-21-6275-5060 china - shenzhen rm. 1812, 18/f, building a, united plaza no. 5022 binhe road, futian district shenzhen 518033, china tel: 86-755-82901380 fax: 86-755-8295-1393 china - shunde room 401, hongjian building no. 2 fengxiangnan road, ronggui town shunde city, guangdong 528303, china tel: 86-765-8395507 fax: 86-765-8395571 china - qingdao rm. b505a, fullhope plaza, no. 12 hong kong central rd. qingdao 266071, china tel: 86-532-5027355 fax: 86-532-5027205 india divyasree chambers 1 floor, wing a (a3/a4) no. 11, o?shaugnessey road bangalore, 560 025, india tel: 91-80-2290061 fax: 91-80-2290062 japan benex s-1 6f 3-18-20, shinyokohama kohoku-ku, yokohama-shi kanagawa, 222-0033, japan tel: 81-45-471- 6166 fax: 81-45-471-6122 korea 168-1, youngbo bldg. 3 floor samsung-dong, kangnam-ku seoul, korea 135-882 tel: 82-2-554-7200 fax: 82-2-558-5932 or 82-2-558-5934 singapore 200 middle road #07-02 prime centre singapore, 188980 tel: 65-6334-8870 fax: 65-6334-8850 taiwan kaohsiung branch 30f - 1 no. 8 min chuan 2nd road kaohsiung 806, taiwan tel: 886-7-536-4818 fax: 886-7-536-4803 taiwan taiwan branch 11f-3, no. 207 tung hua north road taipei, 105, taiwan tel: 886-2-2717-7175 fax: 886-2-2545-0139 europe austria durisolstrasse 2 a-4600 wels austria tel: 43-7242-2244-399 fax: 43-7242-2244-393 denmark regus business centre lautrup hoj 1-3 ballerup dk-2750 denmark tel: 45-4420-9895 fax: 45-4420-9910 france parc d?activite du moulin de massy 43 rue du saule trapu batiment a - ler etage 91300 massy, france tel: 33-1-69-53-63-20 fax: 33-1-69-30-90-79 germany steinheilstrasse 10 d-85737 ismaning, germany tel: 49-89-627-144-0 fax: 49-89-627-144-44 italy via quasimodo, 12 20025 legnano (mi) milan, italy tel: 39-0331-742611 fax: 39-0331-466781 netherlands p. a. de biesbosch 14 nl-5152 sc drunen, netherlands tel: 31-416-690399 fax: 31-416-690340 united kingdom 505 eskdale road winnersh triangle wokingham berkshire, england rg41 5tu tel: 44-118-921-5869 fax: 44-118-921-5820 11/24/03 w orldwide s ales and s ervice


▲Up To Search▲   

 
Price & Availability of PIC16F87

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X